﻿
# absolute value
print "abs(10) =",abs(10)
print "abs(-10) =",abs(-10)

# range
print "range(1,5) =",range(1,5)

# map reduce

# sum 
print "sum([1,2,3,4,5]) =",sum([1,2,3,4,5])
print "sum((1,2,3,4,5)) =",sum((1,2,3,4,5))
print "sum(range(1,11)) =",sum(range(1,11))

#type
print "type(12) =",type(12)
print "type('hello') =",type('hello')
print "type(3.1415926) =",type(3.1415926)
print "type([1,2,3]) =",type([1,2,3])
print "type((1,2,3)) =",type((1,2,3))
print "type({'a':1,'b':2,'c':3}) =",type({'a':1,'b':2,'c':3})
print "type(abs) =",type(abs)
import sys
print "type(sys) =",type(sys)
#print "type() =",type()
#print "type() =",type()


# isinstance(x,type)
print "isinstance('hello',str) =",isinstance('hello',str)
print "isinstance(123,int) =",isinstance(123,int)
print "isinstance(3.1415926,float) =",isinstance(3.1415926,float)
print "isinstance([1,2,3],list) =",isinstance([1,2,3],list)
print "isinstance((1,2,3),tuple) =",isinstance((1,2,3),tuple)
print "isinstance((1),tuple) =",isinstance((1),tuple)
print "isinstance((1,),tuple) =",isinstance((1,),tuple)
print "isinstance({'a':1,'b':2,'c':3},dict) =",isinstance({'a':1,'b':2,'c':3},dict)
#print "isinstance(abs,builtin_function_or_method) =",isinstance(abs,builtin_function_or_method) #error
#print "isinstance() =",isinstance()
#print "isinstance() =",isinstance()
#print "isinstance() =",isinstance()
#print "isinstance() =",isinstance()
#print "isinstance() =",isinstance()
#print "isinstance() =",isinstance()

# filter  Python内建的filter()函数用于过滤序列

# sorted 